<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑任务</title>
    <link rel="stylesheet" href="${request.contextPath}/plugins/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="${request.contextPath}/plugins/font-awesome/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="${request.contextPath}/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="${request.contextPath}/plugins/iCheck/skins/all.css">
    <link rel="stylesheet" href="${request.contextPath}/plugins/jquery-confirm/jquery-confirm.min.css">
    <link rel="stylesheet" href="${request.contextPath}/plugins/bootstrap-table/bootstrap-table.min.css">
    <link rel="stylesheet" href="${request.contextPath}/hadmin/css/animate.css">
    <link rel="stylesheet" href="${request.contextPath}/hadmin/css/style.css">
    <link rel="stylesheet" href="${request.contextPath}/hadmin/css/common.css">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h5>编辑任务</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="jobEditForm" method="post" action="${request.contextPath}/job/sysjob/doEdit">
                        <input class="hidden" name="jobId" value="${sysJob.jobId}">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">任务名称：</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" value="${sysJob.jobName}" name="jobName" placeholder="请输入任务名称" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">任务分组：</label>
                            <div class="col-sm-9">
                                <select name="jobGroup" class="form-control select2" style="width: 100%;" required>
                                    <option value="" selected="selected">--请选择--</option>
                                    <option ${(sysJob.jobGroup=='DEFAULT')?string('selected="selected"','')} value="DEFAULT">默认</option>
                                    <option ${(sysJob.jobGroup=='SYSTEM')?string('selected="selected"','')} value="SYSTEM">系统</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">调用字符串：</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" value="${sysJob.invokeTarget}" name="invokeTarget" placeholder="请输入调用目标" required>
                                <span class="help-block m-b-none">
									<i class="fa fa-info-circle"></i> Bean调用示例：jobTaskTest.jobNoParams()
								</span>
                                <span class="help-block m-b-none">
									<i class="fa fa-info-circle"></i> Class类调用示例：com.hongtech.modules.job.task.CancelOrder.cancel('取消操作')
								</span>
                                <span class="help-block m-b-none">
									<i class="fa fa-info-circle"></i> 参数说明：支持字符串，布尔类型，长整型，浮点型，整型
								</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">cron公式：</label>
                            <div class="col-sm-9">
								<span class="form-control">
                                    当前表达式为：<span id="currentCronExpression">${sysJob.cronExpression}</span>
                                    <a href="javascript:void(0);" onclick="openCron()" class="pull-right">
                                         查看cron表达式
                                    </a>
                                </span>
                                <input type="hidden" class="form-control" id="cronExpression" name="cronExpression" value="${sysJob.cronExpression}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">执行策略：</label>
                            <div class="col-sm-9">
                                <label class="radio-inline">
                                    <input class="minimal" type="radio" ${(sysJob.misfirePolicy==0)?string('checked','')} name="misfirePolicy" value="0" required> 立刻执行
                                </label>
                                <label class="radio-inline">
                                    <input class="minimal" type="radio" ${(sysJob.misfirePolicy==1)?string('checked','')} name="misfirePolicy" value="1" required> 执行一次
                                </label>
                                <label class="radio-inline">
                                    <input class="minimal" type="radio" ${(sysJob.misfirePolicy==2)?string('checked','')} name="misfirePolicy" value="2" required> 放弃执行
                                </label>
                                <span class="help-block m-b-none">
									<i class="fa fa-info-circle"></i> 立刻执行：重做错过的所有频率周期后
								</span>
                                <span class="help-block m-b-none">
									<i class="fa fa-info-circle"></i> 执行一次：以当前时间为触发频率立刻触发一次执行
								</span>
                                <span class="help-block m-b-none">
									<i class="fa fa-info-circle"></i> 放弃执行：不触发立即执行
								</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">并发执行：</label>
                            <div class="col-sm-9">
                                <label class="radio-inline">
                                    <input class="minimal" type="radio" ${(sysJob.concurrent==0)?string('checked','')} name="concurrent" value="0" required> 允许</label>
                                </label>
                                <label class="radio-inline">
                                    <input class="minimal" type="radio" ${(sysJob.concurrent==1)?string('checked','')} name="concurrent" value="1" required> 禁止</label>
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">运行状态：</label>
                            <div class="col-sm-9">
                                <label class="radio-inline">
                                    <input class="minimal" type="radio" ${(sysJob.status==0)?string('checked','')} name="status" value="0" required> 正常
                                </label>
                                <label class="radio-inline">
                                    <input class="minimal" type="radio" ${(sysJob.status==1)?string('checked','')} name="status" value="1" required> 暂停
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">备注描述：</label>
                            <div class="col-sm-9">
                                <textarea class="form-control" id="remark" name="remark" rows="3" placeholder="请输入描述，最多300个字符 ..." required>${sysJob.remark}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-save"></i>  提 交</button>
                                <a class="btn btn-default btn-sm" href="${request.contextPath}/job/sysjob/list">
                                    <i class="fa fa-close"></i>  取消
                                </a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 通用js引入 -->
<script src="${request.contextPath}/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script src="${request.contextPath}/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="${request.contextPath}/plugins/select2/select2.full.min.js"></script>
<script src="${request.contextPath}/plugins/iCheck/icheck.min.js"></script>
<script src="${request.contextPath}/plugins/layer/layer.min.js"></script>
<script src="${request.contextPath}/plugins/laydate/laydate.js"></script>
<script src="${request.contextPath}/plugins/jquery.cookie.js"></script>
<script src="${request.contextPath}/plugins/jquery-confirm/jquery-confirm.min.js"></script>
<script src="${request.contextPath}/plugins/validate/jquery.validate.min.js"></script>
<script src="${request.contextPath}/plugins/validate/messages_zh.min.js"></script>
<script src="${request.contextPath}/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="${request.contextPath}/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="${request.contextPath}/hadmin/js/content.js"></script>
<script src="${request.contextPath}/hadmin/js/common.js?v=0.9"></script>
<script type="text/javascript">
    $(function(){
        $("#jobEditForm").validate();
    });

	function openCron(){
		parent.layer.open({
			type : 2,
			title : 'cron表达式',
			closeBtn : 1,
			anim: -1,
			isOutAnim: false,
			shadeClose : true,
			shade : 0.3,
			area : ['800px', '600px'],
			btn : [ '确定', '取消' ],
			content : '${request.contextPath}/job/sysjob/cronPage',
			yes : function(index, layero) {
                const cronValue = layero.find('iframe')[0].contentWindow.submitHandler();
                $("#currentCronExpression").text(cronValue);
                $("#cronExpression").val(cronValue);
			}
		})
	}
	</script>
</body>
</html>